Superposition
<h1>Superposition</h1>
<p>
Superposition is one of the most important principles in <strong>quantum computing</strong>.
It allows a quantum bit (qubit) to exist in multiple states at the same time.
</p>
<p>
In classical computers, a bit can only be in one state at a time:
</p>
<ul>
<li>0</li>
<li>1</li>
</ul>
<p>
But in quantum computing, a <strong>qubit</strong> can exist as a combination of both states simultaneously.
This property is called <strong>superposition</strong>.
</p>
<img src="/static/images/bloch_sphere.png"
alt="Qubit Superposition Bloch Sphere" class="img-fluid">
<hr>
<h2>Classical Bit vs Qubit</h2>
<table border="1" cellpadding="10">
<tr>
<th>Feature</th>
<th>Classical Bit</th>
<th>Quantum Bit (Qubit)</th>
</tr>
<tr>
<td>Possible State</td>
<td>0 OR 1</td>
<td>0 AND 1 (Superposition)</td>
</tr>
<tr>
<td>Computation</td>
<td>Single state processing</td>
<td>Parallel possibilities</td>
</tr>
</table>
<hr>
<h2>Mathematical Representation</h2>
<p>
A qubit in superposition can be represented mathematically as:
</p>
<pre>
|ψ⟩ = α|0⟩ + β|1⟩
</pre>
<p>
Where:
</p>
<ul>
<li><strong>|ψ⟩</strong> represents the quantum state</li>
<li><strong>α</strong> and <strong>β</strong> are probability amplitudes</li>
<li>The total probability must equal 1</li>
</ul>
<pre>
|α|² + |β|² = 1
</pre>
<hr>
<h2>Real Life Analogy</h2>
<p>
A common analogy for superposition is a <strong>spinning coin</strong>.
</p>
<ul>
<li>Heads = 0</li>
<li>Tails = 1</li>
</ul>
<p>
When the coin is spinning, it is neither purely heads nor tails.
It is in a combination of both states until it lands.
</p>
<p>
Similarly, a qubit remains in superposition until it is measured.
</p>
<hr>
<h2>Example: Creating Superposition using Qiskit</h2>
<p>
In quantum programming, a superposition is created using a <strong>Hadamard Gate (H)</strong>.
</p>
<pre><code class="language-python">
from qiskit import QuantumCircuit
# Create a quantum circuit with 1 qubit
qc = QuantumCircuit(1)
# Apply Hadamard gate to create superposition
qc.h(0)
# Measure the qubit
qc.measure_all()
print(qc)
</code></pre>
<hr>
<h2>Why Superposition is Powerful</h2>
<p>
Superposition allows quantum computers to evaluate multiple possibilities simultaneously.
This capability helps solve problems faster than classical computers in certain cases.
</p>
<ul>
<li>Quantum simulations</li>
<li>Optimization problems</li>
<li>Cryptography</li>
<li>Machine learning</li>
</ul>
<hr>
<h2>Conclusion</h2>
<p>
Superposition is the foundation of quantum computing power.
By allowing qubits to exist in multiple states simultaneously,
quantum computers can explore many computational paths at once.
</p>